const getAddress = (allAreas, list) => {
    console.log(allAreas, list)
    var pId = list[0],
        cId = list[1],
        aId = list[2],
        p = '', // 省
        c = '', // 市
        a = '', // 区
        addr = ''

    allAreas.forEach(item => {
        if (item.id == pId) {
            p = item.name
            item.children.forEach(k => {
                if (k.id == cId) {
                    c = k.name

                    k.children.forEach(j => {
                        if (j.id == aId) {
                            a = j.name
                        }
                    })
                }
            })
        }
    })

    addr = p + c + a

    return addr
}

// 处理非空数据
const dealObjectValue = function (obj) {
    var param = {}
    if (obj === null || obj === undefined || obj === '') return param
    for (var key in obj) {
        if (
            obj[key] !== null &&
            obj[key] !== undefined &&
            obj[key] !== '' &&
            obj[key].length !== 0
        ) {
            param[key] = obj[key]
        }
    }
    return param
}

export { getAddress, dealObjectValue }
